﻿using DAL.DBManagers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class InvoiceEdit : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void ddlClients_SelectedIndexChanged(object sender, EventArgs e)
    {
        using (ClientsManager manager = new ClientsManager())
        {
            var client = manager.SingleOrDefault(s => s.ClientID == Guid.Parse(ddlClients.SelectedValue));

            if (client != null)
            {
                lblTRN.Text = client.TRN;
            }
        }
    }

    protected void ddlVessel_SelectedIndexChanged(object sender, EventArgs e)
    {
        using (VesselsManager manager = new VesselsManager())
        {
            //var vessel = manager.Single(s => s.VesselID == Guid.Parse(ddlVessel.SelectedValue));

            //lblVesselName.Text = vessel.Name;
            //lblIMO.Text = vessel.IMO.ToString("F0");
            //lblFalg.Text = vessel.Flag.Name;
            //lblLOA.Text = vessel.LOA.ToString("F0");
            //lblRegime.Text = vessel.Flag.NavigationMode.Name;
            //lblBeam.Text = vessel.Beam.ToString("F0");
            //lblDepth.Text = vessel.Depth.ToString("F0");
            //lblVesselType.Text = vessel.VesselType.Name;

            //var code = manager.GetVesselCodeID(vessel.VesselID, true, new Guid("798A2D45-794F-4F76-B254-80E9C1F3DE3C"));
            //lblVesselCode.Text = code;
        }
    }
}